<?php
// 通讯录联系人
$json_data = file_get_contents('php://input');
$data_array = json_decode($json_data, true);
$id = $data_array['id']; // 部门ID, =0时为读取全部一级部门与成员列表
$query = [
    [
        'id' => 1, // 部门ID 
        'name' => '销售部', // 部门名称 
        'dept' => 1, // 存在则为部门 
        'icon' => 'layout-grid', // 部门 icon name
    ],
    [
        'id' => 2,
        'name' => '客户服务部',
        'dept' => 1
    ],
    [
        'id' => 3,
        'name' => '营销部',
        'dept' => 1,
        'icon' => 'paperclip', 
    ],
    [
        'id' => 4,
        'name' => '人力资源部',
        'dept' => 1,
    ],
    [
        'id' => 5,
        'name' => '研发部',
        'dept' => 1,
    ],
    [
        'id' => 1, // 联系人ID
        'name' => '孙正义', // 昵称
        'phone' => '18318227678', // 手机
        'url' => 'http://demo.api.lutui.net/avatar/avatar.jpg' // 头像
    ],
    [
        'id' => 2,
        'name' => 'Jack',
        'phone' => '19447646145',
        'url' => 'http://demo.api.lutui.net/avatar/avatar_1.jpg'
    ],
    [
        'id' => 3,
        'name' => '杜娟',
        'phone' => '15794082962',
        'url' => 'http://demo.api.lutui.net/avatar/avatar_2.jpg'
    ],
    [
        'id' => 4,
        'name' => 'Doris',
        'phone' => '19447646145',
        'url' => 'http://demo.api.lutui.net/avatar/avatar_3.jpg'
    ],
    [
        'id' => 5,
        'name' => 'David',
        'phone' => '17855236828',
        'url' => 'http://demo.api.lutui.net/avatar/avatar_4.jpg'
    ],
    [
        'id' => 6,
        'name' => '任盈盈',
        'phone' => '13344617149',
        'url' => 'http://demo.api.lutui.net/avatar/avatar_5.jpg'
    ],
    [
        'id' => 7,
        'name' => '阿发',
        'phone' => '17959660268',
        'url' => 'http://demo.api.lutui.net/avatar/avatar_place.png'
    ],
];
if ($id > 0){
    $one = rand(0, 4);
    unset($query[$one]);
    $two = rand(5, 11);
    unset($query[$two]);
    $query = array_values($query);
}
echo json_encode($query, 256);